<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');
?>
<form action="?m=ushop&c=sale&a=search_sale&menuid=<?php echo $_GET['menuid'];?>" method="post"  style="margin:10px auto; width:99%;">
<table width="100%" cellspacing="0" class="search-form">
    <tbody>
		<tr>
		<td>
        <div class="explain-col" style="text-align:left;">
			<?php echo '开始时间'; ?>:
			<?php echo form::date('search[start_time]','','')?> 
			<?php echo '开始时间';?>   
			<?php echo form::date('search[end_time]','','')?>    
            <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit">
		</div>
		</td>
		</tr>
    </tbody>
</table>
</form>

<form action="?m=ushop&c=sale&a=sale_order&menuid=<?php echo $_GET['menuid'];?>" method="post" id="sale_form">
<div class="table-list" style="width:99%; margin:auto;">
<table width="100%" cellspacing="0">
	<thead>
		<tr>
			<th width="35" align="center">排行</th>
			<th width="35%" align="center">商品名称</th>
			<th width="10%" align="center">货号</th>
			<th width='10%' align="center">销售量&nbsp;
                <a href="javascript:alse_sort('goods_number','desc')"><img src="<?php echo IMG_PATH ;?>sort_desc.gif" /></a>&nbsp;
                <a href="javascript:alse_sort('goods_number','asc')"><img src="<?php echo IMG_PATH ;?>sort_asc.gif" /></a>
            </th>
			<th width="15%" align="center">销售额&nbsp;
                <a href="javascript:alse_sort('turnover','desc')"><img src="<?php echo IMG_PATH ;?>sort_desc.gif" /></a>&nbsp;
                <a href="javascript:alse_sort('turnover','asc')"><img src="<?php echo IMG_PATH ;?>sort_asc.gif" /></a>
            </th> 
            <th align="center">均价</th>
            <input type="hidden" name="sale_order" value="" id="sale_order" />
		</tr>
	</thead>
<tbody>
<?php
if(is_array($infos) && !empty($infos)){
	foreach($infos as $info){
?>
	<tr>
		<td><?php echo $info['subject']?></td>
		<td align="" widht="35%"><?php echo $info['content'];?></td>
		<td align="center" width="10%"><?php echo $info['send_from_id'];?></td>
		<td align="center" width="10%"><?php echo $info['send_to_id'];?></td>
        <td align="center" width="10%"><?php echo $info['send_to_id'];?></td>
        <td align="center" width="10%"><?php echo $info['send_to_id'];?></td>
	</tr>
	<?php
	}
}elseif(empty($infos)) {
?>
	<tr>
    	<td colspan="6" align="center">暂时还没有数据</td>
    </tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<script>
	function alse_sort(sort_by,sort_order) {
		document.getElementById('sale_order').value = sort_by+'&'+sort_order;
		document.getElementById('sale_form').submit();
	}
</script>
</body>
</html>